Agentic Review: Baseline comparison#34926
Conversation
4be9f90 to
ad35795
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds baseline-vs-latest preview comparison to the Review addon: an experimental devServer preset that proxies baseline requests via /__review-baseline, a refactored DetailsScreen with dual iframes, synchronized scrolling and 1-up/2-up preview modes, and a GuidePage title update. ChangesBaseline-vs-Latest Review Comparison
Sequence Diagram(s)sequenceDiagram
participant DevServerApp
participant review_preset as review/src/preset.ts
participant ChromaticOrigin
DevServerApp->>review_preset: mount experimental_devServer(app)
review_preset->>DevServerApp: register proxy at /__review-baseline
DevServerApp->>ChromaticOrigin: proxied request (path rewritten, changeOrigin)
sequenceDiagram
participant DetailsScreen
participant LatestIframe as Latest Preview Iframe
participant BaselineIframe as Baseline Preview Iframe
participant Addons as Storybook Addons Channel
LatestIframe->>DetailsScreen: load/navigation event
DetailsScreen->>DetailsScreen: compute baseline proxy URL (toBaselinePreviewUrl)
DetailsScreen->>BaselineIframe: set src to proxy URL
BaselineIframe->>Addons: STORY_RENDERED
Addons->>DetailsScreen: deliver STORY_RENDERED
DetailsScreen->>DetailsScreen: setup bidirectional scroll sync
DetailsScreen->>LatestIframe: apply scroll position
DetailsScreen->>BaselineIframe: apply scroll position
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Comment |
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 0 | 0 | 0 |
| Self size | 53 KB | 206 KB | 🚨 +153 KB 🚨 |
| Dependency size | 654 B | 654 B | 0 B |
| Bundle Size Analyzer | Link | Link |
|
Actionable comments posted: 0 |
1 similar comment
|
Actionable comments posted: 0 |
…screen with 1up/2up modes, view toggles, and readiness gating so latest stays visible while baseline loads. Also proxy baseline previews through a local __review-baseline dev-server route and keep the two iframes aligned by syncing URL and scroll position.
8f1fff5 to
b677c0a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/addons/review/src/preset.ts`:
- Around line 79-87: The proxy created in createProxyMiddleware (assigned to
proxyRequest) lacks timeout and deterministic error handling; update the options
passed to createProxyMiddleware (for the instance referenced as proxyRequest and
mounted via app.use(BASELINE_PROXY_PATH)) to include timeout and proxyTimeout
values (e.g., sensible millisecond limits), and add an on.error handler that
sends a deterministic HTTP failure (e.g., 502/504 with a short JSON/plain text
body) and ends the response to avoid hanging the request when
BASELINE_TARGET_ORIGIN is slow/unreachable; keep existing changeOrigin and
pathRewrite behavior and ensure the handler checks res.headersSent before
writing a response.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c695d1e-0cc1-4f59-a8c6-bba28ad492a6
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
code/addons/review/package.jsoncode/addons/review/src/preset.tscode/addons/review/src/screens/DetailsScreen.stories.tsxcode/addons/review/src/screens/DetailsScreen.tsxcode/core/src/manager/settings/GuidePage.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
- code/core/src/manager/settings/GuidePage.tsx
- code/addons/review/src/screens/DetailsScreen.stories.tsx
- code/addons/review/src/screens/DetailsScreen.tsx
Guard documentElement before setting overscroll styles in DetailsScreen,
since the capture-loopback baseline iframe can expose a document with a
null documentElement, throwing "Cannot read properties of null (reading
'style')" during the Details story.
Update the SummaryScreen Minimal play function to match the current
generic headline ("Showing N agent-curated stories...") instead of the
removed branch-specific text.
Co-authored-by: Cursor <cursoragent@cursor.com>
The baseline preview proxies to a remote Chromatic origin that can be slow or unreachable. Bound the wait with timeout/proxyTimeout and return a deterministic 502 via on.error so a dead connection fails fast instead of hanging the review UI's baseline iframe. Co-authored-by: Cursor <cursoragent@cursor.com>
6332063 to
42403d1
Compare
… prop The Details play function asserted on "Latest on <branch>" text, a branch footer that was removed when branch-specific copy was dropped from the review UI. Assert on the always-rendered latest preview iframe instead, matching DetailsScreen.stories, and remove the now-unused branchName prop that was threaded into DetailsScreen but never rendered.
Fetch the baseline Storybook's index.json (via the existing review proxy, keyed on the review's createdAt) and flag stories that don't exist in the baseline with a positive "New" badge in the DetailsScreen toolbar. No badge shows when the baseline is unavailable or the story already exists.
- Hide the baseline preview, side-by-side toggle and bottom comparison bar for newly added stories (no baseline to compare against). - Render the baseline pane and comparison bar immediately since baseline existence is known up front, instead of waiting for the iframe onload. - Default to the 2-up side-by-side layout and remember the user's 1up/2up choice across detail/summary navigation via sessionStorage.
Centralize all sessionStorage usage in a single session-store utility that guards every access (privacy modes, disabled storage, sandboxed iframes can throw), so persistence degrades gracefully and in-memory state still drives the current session.
The detail screen now treats a story as new when the change-detection mechanism flags it (status-value:new), in addition to the existing baseline-absence check. This surfaces newly added stories even when a baseline exists or is unavailable.
- Remove unsupported branchName prop passed to DetailsScreen in the ReviewFlowDemo prototype story (DetailsScreen never consumed it). - Anchor ReviewPage story createdAt to Date.now() so the "Created … ago" label renders as a small, stable value instead of computing minutes against a fixed past timestamp (caused a huge number in Chromatic).
Revert the summary header to a non-semantic clickable row (a pointer affordance only) and move the accessible toggle back to the chevron <Button>, which carries the aria-label and now aria-expanded state for assistive tech. This also restores the chevron's column alignment under the toolbar's expand/collapse-all button without the manual margin hack.
When opening the detail screen, focus stayed on the now-hidden summary because React 18 drops a boolean `inert` prop. Set the DOM property imperatively so the mounted summary leaves the tab order and a11y tree, and focus the back control when the detail screen mounts.
Focusing the heading orients screen-reader users by what they opened rather than landing on an action; the heading is a programmatic focus target (tabindex=-1) with no focus ring.
The "Find stories" input had no visible focus indicator. Mirror the sidebar search: the wrapper owns the focus ring while the input stays outline-less.
d3f526e
into
yann/agentic-review-mcp-integration
What I did
Adds a baseline-vs-latest comparison experience to the Agentic Review Details screen:
1up(single, overlaid) and2up(side-by-side) layouts; in single mode a swap control flips which side is shown./__review-baselinedev-server route (experimental_devServer+http-proxy-middleware) to avoid cross-origin issues.DetailsScreenstories/play functions to target the Guide Page story.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
cd code && yarn storybook:ui) with the review addon enabled./__review-baselineproxy and the latest preview stays visible while it loads.1upand2uplayouts; in1upuse the swap control to flip between baseline and latest.Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-34926-sha-a0498164. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-34926-sha-a0498164 sandboxor in an existing project withnpx storybook@0.0.0-pr-34926-sha-a0498164 upgrade.More information
0.0.0-pr-34926-sha-a0498164review-baseline-comparisona04981641779970666)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=34926Summary by CodeRabbit
New Features
Chores